<#assign className = table.className>
<#assign classNameLower = className?uncap_first>
<#assign classNameAllLower = className?lower_case>
<#assign hasParentSearchField = 'false'>
<#if adminSearchField?? && adminSearchField != "">
    <#list adminSearchField?split(",") as field>
        <#if field?contains("_") && field?contains(".")>
            <#assign hasParentSearchField = 'true'>
            <#break>
        </#if>
    </#list>
</#if>
package ${basePackage}.${moduleName}.service;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import ${basePackage}.${moduleName}.dao.${className}Dao;
import ${basePackage}.${moduleName}.model.entity.${className};
import ${basePackage}.${moduleName}.model.request.${className}Form;
import ${basePackage}.${moduleName}.model.response.${className}VO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * ${table.remarks}-ServiceImpl
 *
 * @author
 */
@Service
@Slf4j
public class ${className}ServiceImpl extends ServiceImpl<${className}Dao, ${className}> implements ${className}Service {

    @Override
    public int add(${className}Form ${classNameLower}Form) {

        //校验

        ${className} ${classNameLower} =new ${className}();
        CopyOptions copyOptions = CopyOptions.create()
        .setEditable(${className}.class)
        .setIgnoreError(true)
        .setIgnoreNullValue(true);
        BeanUtil.copyProperties(${classNameLower}Form, ${classNameLower}, copyOptions);

        return baseMapper.insert(${classNameLower});
    }
    <#if hasParentSearchField = 'true'>

    @Override
    public List<${className}> list(Map<String, Object> params) {
        return baseMapper.list(params);
    }

    @Override
    public Page<${className}> pageList(Page page, Map<String, Object> params) {
        List<${className}> list = baseMapper.list(page, params);
        page.setRecords(list);
        return page;
    }
    </#if>

    @Override
    public List<${className}VO> list4app(Map<String, Object> params) {
        return baseMapper.list4app(params);
    }

    @Override
    public Page<${className}VO> pageList4app(Page page, Map<String, Object> params) {
        List<${className}VO> list = baseMapper.list4app(page, params);
        page.setRecords(list);
        return page;
    }

    @Override
    public ${className}VO get4appById(Long id) {
        return baseMapper.get4appById(id);
    }
}
